import { createRouter, createWebHistory } from 'vue-router'
import type { RouteRecordRaw } from 'vue-router'

import TabsView from '../views/tabs/TabsView.vue'
import HomeView from '../views/tabs/home/HomeView.vue'
import OrderView from '../views/tabs/order/OrderView.vue'
import MeView from '../views/tabs/me/MeView.vue'

const routes: RouteRecordRaw[]  = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/tabs',
    name: 'tabs',
    component: TabsView,
    children: [
      { name: 'home', path: '/home', component: HomeView },
      { name: 'order', path: '/order', component: OrderView },
      { name: 'me', path: '/me', component: MeView }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes,
  // history: createWebHashHistory()
})

export default router
